#ifndef GAME_THREAD_HH
# define GAME_THREAD_HH

# include <iostream>
# include <set>
# include <tbb/concurrent_queue.h>
# include <tbb/concurrent_hash_map.h>

# include "request/request-handler-server.hh"
# include "misc/obj-vect.hh"

# include "client.hh"

class Server;

class GameThread
{
public:
  GameThread (Server* s,
	      const tbb::concurrent_hash_map<int, boost::shared_ptr<Client> >& cl,
	      ObjVect* objvect);

  ~GameThread ();

  virtual void run () = 0;

  void push (const boost::shared_ptr<Request>& r);

  ObjVect* objvect () const { return objvect_; }

protected:
  void send_physic_updates (const std::set<Object*>& mov_obj);

  tbb::concurrent_queue<boost::shared_ptr<Request> > r_;
  const tbb::concurrent_hash_map<int, boost::shared_ptr<Client> >& cl_;
  ObjVect* objvect_;
  RequestHandlerServer rh_;
};

#endif /// !GAME_THREAD_HH
